# coding: utf-8

"""
author:  O_O
"""

import itertools

from main.common.perm.perms_json import perms_json


PERMS_CONFIG = (
    {
        "business_module": "系统配置",
        "perms": (
            {
                "name": "登录到dcode后台系统",
                "codename": "login_dcode_background",
            },
        ),
    },
)

# ALL_PERMS 数据格式
# [
#    ('perms_code1', 'perms1 description'),
#    ('perms_code2', 'perms2 description'),
#    ...
# ]
ALL_PERMS = list(
    itertools.chain.from_iterable(
        [
            [(perm["codename"], perm["name"]) for perm in perm_config["perms"]]
            for perm_config in PERMS_CONFIG
        ]
    )
)
ALL_PERMS += perms_json
